import {PostSetting,GetSetting} from '@/api/setting'
const state = {
    settingList:{}
}

const mutations = {
    update(state, payload){
        console.log(payload);
        for(let key in payload){
            state[key] = payload[key]
        }
    }
}

const actions = {
   async GetSetting({ commit }){
        const result = await GetSetting()
        if(result.statusCode === 200){
            commit('update', {settingList:result.data})
        }
    },
    async PostSetting({ commit }, payload){
        console.log(payload);
        const result = await PostSetting(payload);
        console.log(result,'---result---');
        if(result.statusCode === 200){
            commit('update', {settingList:result.data})
        }
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions,
}